from time import sleep

from remoteDB import ArticleDB
from iData import IData
import traceback

if __name__ == '__main__':
    db = ArticleDB()
    bot = IData()
    while True:
        try:
            article_id = db.GetOneArticleForPeriodical()
            sqldata = bot.getPeriodicalInfo(article_id)
            db.InsertIntoPeriodical(sqldata)
        except Exception as e:
            traceback.print_exc()
            print('休眠10s。。')
            sleep(1)
        finally:
            print('休眠10s。。')
            sleep(1)
